<template>
	<view class="">
		<!-- 头部 -->
		<view class="u-p-30 bg_FFFFFF u-flex u-row-between">
			<view class="u-flex">
				<view class="" style="width: 7rpx ;height: 28rpx; background-color: #FF2736FF; border-radius: 3rpx;">
				</view>
				<view class="u-m-l-20">历史贡献值</view>
			</view>
		</view>
		<!-- 中奖列表信息 -->
		<view class=" u-p-20 ">
			<view class="u-p-20 bg_FFFFFF" v-for="(item,index) in list" :key="index">
				<view class=" u-flex " style="border-bottom: 1rpx solid #E2EBF4;">
					<view class="u-w-700  u-p-b-28">
						<view class="u-flex u-font-28 u-row-between u-p-t-6">
							<view class="cl_1C1C1CFF u-weight ">{{item.order_sn}}</view>
							<view class="">
							累计 <text class="cl_FC3533FF ">{{item.all_conval}}</text> </view>
						</view>
					</view>
				</view>
				<view :class="item.check?'':'u-h-260 u-hidden'" class="">
					<view class="u-p-t-20 u-p-b-20 u-font-28" style="border-bottom: 1rpx solid #E2EBF4;" v-for="(list,lindex) in item.con_val_list" :key="lindex" >
						<view class=" u-flex u-row-between u-col-top">
							<view class="">
							{{list.order_sn}}
							</view>
							<view class="">
								{{list.create_time}}
							</view>
						</view>
						<view class="u-weight u-m-t-20 u-flex u-row-between u-col-top">
							<view class="">
								{{list.remark}}
							</view>
							<view class="cl_FB473CFF">
								{{list.val}}
							</view>
						</view>
						
					</view>
				</view>
				<view class="u-flex u-row-center" v-if="!item.check" @click="isShow(item)">
					<view class="u-text-center u-m-t-20 u-p-20" style="color:#49B0FF ;">查看全部</view>
					<u-image src='https://www.sqkjkj.vip/wxImg/mylick/img5.png' width='16rpx' height='16rpx'></u-image>
				</view>	
				<view class="u-flex u-row-center" v-else @click="isShow(item)">
					<view class="u-text-center u-m-t-20 u-p-20" style="color:#49B0FF ;">收起</view>
					<u-image src='https://www.sqkjkj.vip/wxImg/mylick/img6.png' width='16rpx' height='16rpx'></u-image>
				</view>
			</view>
		</view>
		<!-- 加载更多 -->
		<u-loadmore :status="status" icon-type="circle" margin-bottom="20" />
		<u-select v-model="dayShow" :list="dayList" @confirm="dayFirm"></u-select>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				// 天
				dayShow: false,
				dayList: [{
						value: 1,
						label: 1
					},
					{
						value: 5,
						label: 5
					},
					{
						value: 7,
						label: 7
					},
					{
						value: 10,
						label: 10
					},
					{
						value: 15,
						label: 15
					}
				],
				params: {
					page: 1,
					page_size: 20,
					time_length:''
				},
				status: 'loadmore',
				list: []
			}
		},
		onLoad() {
			this.clear()
			this.massage()
		},
		// 下拉到底事件
		onReachBottom() {
			//避免多次触发
			if (this.status == 'loading' || this.status == 'nomore') {
				return;
			}
			this.massage();
		},
		methods: {
			// 选择天数
			dayFirm(e){
				this.params.time_length=e[0].label
				this.clear()
				this.massage()
			},
			clear() {
				this.list = [];
				this.params.page = 1;
			},
			massage() {
				this.$api.con_val_list(this.params, res => {
					if (res.data.code == 1) {
						res.data.data.data.forEach(d=>{
							d.check=false
						})
						if (res.data.data.data.length < 20) {
							this.status = 'nomore';
						} else {
							this.params.page = this.params.page + 1;
							this.status = 'loadmore';
						}
						this.list = this.list.concat(res.data.data.data);
						console.log(this.list)
						uni.stopPullDownRefresh();
					}
				})
			},
			isShow(item){
				item.check=!item.check
			}
		}
	}
</script>

<style scoped>
	page {
		background: #F5F5F5FF !important;
	}
</style>
